package com.ajl.wx.global;

import com.ajl.wx.beans.vo.ResultApi;
import com.ajl.wx.utils.ResultApiUtil;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class ErrorController {

    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public ResultApi handlerException(Exception e){
        return ResultApiUtil.fail(-2,e.getMessage());
    }
}
